<?php
namespace app\admin\logic;
use app\admin\validate\Role as RoleValidate;

class RoleLogic extends BaseLogic {

    /**
     * 获取角色查询条件
     * @return array
     */
    public function get_search_role_maps(){
        $maps = [];

        return $maps;
    }

    /**
     * 检查修改角色规则
     * @param $params
     * @return mixed
     */
    public function check_save_role_rule($params){
        $validate = new RoleValidate();
        $r = $validate->scene('edit')->check($params);
        if(!$r){
            return $this->get_response(0,$validate->getError());
        }

        $maps = [];
        $maps[] = ['id','=',$params['roleid']];
        $r_detail =  model('role')->get_detail($maps,'id');
        if(empty($r_detail)){
            return $this->get_response(0,'该角色不存在');
        }

        $data['r_detail'] = $r_detail;
        return $this->get_response(1,'OK',$data);
    }
}